package main

import (
	"fmt"
	"strings"

	"github.com/aidarkhanov/nanoid/v2"
)

func DealBodyrt(rd string) map[string]string {
	params := map[string]string{}
	bodya := strings.Split(rd, "	")
	for i := 0; i < len(bodya); i++ {
		k := strings.Split(bodya[i], "=")
		if len(k) < 2 {
			continue
		}
		params[k[0]] = k[1]
	}
	return params
}

func DealRes(str string) map[string]string {
	res := make(map[string]string)
	tmp1 := strings.Split(str, "&")
	for _, v := range tmp1 {
		tmp := strings.Split(v, "=")
		if len(tmp) >= 2 {
			res[tmp[0]] = tmp[1]
		}
	}
	return res
}

func GetUUID() (string, error) {
	u2, err := nanoid.New()
	if err != nil {
		fmt.Printf("Something went wrong: %s", err)
		return "", err
	}
	return u2, nil
}

func (scn *sc) init() {
	scn.step1 = true
	scn.step2 = true
	scn.step3 = true
}

func (dcn *dc) init() {
	dcn.step1 = true
	dcn.step2 = true
}
